﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using BloggerAutoPosterService.Engine.Utils;

namespace BloggerAutoPoster.Common.Converters
{
    public class RunDirectionConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null || string.IsNullOrWhiteSpace(value.ToString()))
                return FlowDirection.LeftToRight;

            return value.ToString().ContainsFarsi()? FlowDirection.RightToLeft : FlowDirection.LeftToRight ;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
